import 'package:flutter/material.dart';
import 'package:my_app_01/components/MCard.dart';

class MTitle extends StatelessWidget {
  final IconData? icon;
  final Widget? title;
  final Widget? right;

  void Function()? rightTap;

  MTitle({super.key, this.icon, this.title, this.right, this.rightTap});

  @override
  Widget build(BuildContext context) {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        Expanded(
          flex: 1,
          child: Wrap(
            crossAxisAlignment: WrapCrossAlignment.center,
            children: [
              Padding(
                  padding: const EdgeInsets.only(right: 5),
                  child: Icon(
                    icon,
                    color: Colors.teal,
                  )),
              title!
            ],
          ),
        ),
        InkWell(
          onTap: rightTap,
          child: Container(
            alignment: Alignment.centerRight,
            child: right,
          ),
        ),
      ],
    );
  }
}
